package com.javacore;


public class Rectangle {
	//These are the fields used to store the width and height of your Rectangle object.
	private float height;
	private float width;


	//Constructor for the class, used to set up all data when a 
	//Rectangle object is created. This default constructor creates
	//a Rectangle object with a width and height of 1.0
	public Rectangle() {
		width = 0;
		height = 0;
	}
	
	
	//This is another constructor for the Rectangle class that accepts
	//two arguments that are of the type float. This is what the you
	//will use when you know what the width and height of the Rectangle
	//object is when you create it. The constructor takes w and h and 
	//sets them equal to width and height respectivley.
	public Rectangle(float w, float h) {
		width = w;
		height = h;
	}
	
	
	//Here is the getArea method, it uses the width and height 
    //field that is stored in your rectangle object to
	//calculate the area.
	public float area(){
	   return width * height;
	}
	
	//This is a setter method, it is used to change the value of width
	//to whatever w is.
	public void setWidth(float w) {
		width = w;
	}
	
	//This is a setter method, it is used to change the value of height
	//to whatever h is.
	public void setHeight(float h) {
		height = h;
	}
	
	//This is a getter method, it is used to retrieve the value of width
	//at the current time.
	public float getWidth() {
		return width;
	}
	
	//This is a getter method, it is used to retrieve the value of height
	//at the current time.
	public float getHeight() {
		return height;
	}
	
		
	//Here is the getPerimeter method, it uses the width and height 
    //field that is stored in your rectangle object to
	//calculate the perimeter.
	public float perimeter(){
	   return (2*width) + (2*height);
        }
        
}

